#!/bin/sh
device=''
max=0
cd /sys/class/net || echo 'folder /sys/class/net does not exist'
for i in *; do
    rx_bytes=$(cat $i/statistics/rx_bytes)
    tx_bytes=$(cat $i/statistics/tx_bytes)
    bytes=$(echo "$rx_bytes + $tx_bytes" | bc)
    [ $(echo "$bytes > $max" | bc) -eq 1 ] && max="$bytes" && device=$i
done

echo -n $device
